错误 LNK2005 “public:

您所在的位置:网站首页 std::ofstream fout 错误 LNK2005 “public:

错误 LNK2005 “public:

2023-04-16 12:46| 来源: 网络整理| 查看: 265

OSG系列文章目录文章目录​​OSG系列文章目录​​​​前言​​​​一、错误原因​​​​二、解决办法​​前言

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2005 “public: __cdecl std::basic_ifstream::basic_ifstream(void)” (??0?错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_basic_ifstreamchar_traits@D@std@@@std@@QEAA@XZ) 已经在 osgDB.lib(osg141-osgDB.dll)

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2005 “public: void __cdecl std::basic_ifstream::open(class std::basic_string const &,int,int)” (?open@?错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_basic_ifstreamchar_traits@D@std@@@std@@QEAAXAEBV?错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_ofstream重定义_03char_traits@D@std@@V?$allocator@D@2@@2@HH@Z) 已经在 osgDB.lib(osg141-osgDB.dll)

严重性 代码 说明 项目 文件 行 禁止显示状态

错误 LNK2005 “public: void __cdecl std::basic_ifstream::`vbase destructor’(void)” (??_D?错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_basic_ifstreamchar_traits@D@std@@@std@@QEAAXXZ) 已经在 osgDB.lib(osg141-osgDB.dll) 中定义

错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_osgDB_05

一、错误原因

因为在工程中使用了osgDB.lib库,osgDB.lib库中已经包含了basic_ifstream类,而我在工程中又包含了iostream,重复包含iostream头文件

include#include#include#include#include#include#include#include#include#include#pragma comment(lib,"gdiplus.lib")

#include #include #include #include #include #include #include #include #include #include #include #include #include #include

#include "Ground_Calculate.h"#include "MeshAnalyzer.h"#include "myFindNodeVisitor.h"#include "MyStruct.h"#include "Shadow_mapping.h"#include "SolarDirection.h"#include "Scene_Calculate.h"#include

using namespace std;using namespace Gdiplus;

#pragma comment(linker,"/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )

错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_#include_06

二、解决办法

明确使用osgDB中的ifstrean和ofstream读写文件

osgDB::ifstream fin;

Color color;

osgDB::ofstream fout(outfilename.c_str());

fout.close();

错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_ofstream重定义_07

错误 LNK2005 “public: __cdecl std::basic_ifstream<char,struct std::char_traits<char> >::basic_ifstream_ofstream重定义_08



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3